/* Options:
Date: 2025-10-14 12:51:19
Version: 8.81
Tip: To override a DTO option, remove "//" prefix before updating
BaseUrl: https://localhost:5001

//GlobalNamespace: 
//MakePropertiesOptional: False
//AddServiceStackTypes: True
//AddResponseStatus: False
//AddImplicitVersion: 
//AddDescriptionAsComments: True
IncludeTypes: ChatCompletion.*
//ExcludeTypes: 
//DefaultImports: 
*/


export interface IReturn<T>
{
    createResponse(): T;
}

export interface IPost
{
}

// @DataContract
export class AiContent
{
    /** @description The type of the content part. */
        // @DataMember(Name="type")
    public type: string;

    public constructor(init?: Partial<AiContent>) { (Object as any).assign(this, init); }
}

/** @description The tool calls generated by the model, such as function calls. */
// @DataContract
export class ToolCall
{
    /** @description The ID of the tool call. */
        // @DataMember(Name="id")
    public id: string;

    /** @description The type of the tool. Currently, only `function` is supported. */
        // @DataMember(Name="type")
    public type: string;

    /** @description The function that the model called. */
        // @DataMember(Name="function")
    public function: string;

    public constructor(init?: Partial<ToolCall>) { (Object as any).assign(this, init); }
}

/** @description A list of messages comprising the conversation so far. */
// @DataContract
export class AiMessage
{
    /** @description The contents of the message. */
        // @DataMember(Name="content")
    public content?: AiContent[];

    /** @description The role of the author of this message. Valid values are `system`, `user`, `assistant` and `tool`. */
        // @DataMember(Name="role")
    public role: string;

    /** @description An optional name for the participant. Provides the model information to differentiate between participants of the same role. */
        // @DataMember(Name="name")
    public name?: string;

    /** @description The tool calls generated by the model, such as function calls. */
        // @DataMember(Name="tool_calls")
    public tool_calls?: ToolCall[];

    /** @description Tool call that this message is responding to. */
        // @DataMember(Name="tool_call_id")
    public tool_call_id?: string;

    public constructor(init?: Partial<AiMessage>) { (Object as any).assign(this, init); }
}

/** @description Parameters for audio output. Required when audio output is requested with modalities: [audio] */
// @DataContract
export class AiChatAudio
{
    /** @description Specifies the output audio format. Must be one of wav, mp3, flac, opus, or pcm16. */
        // @DataMember(Name="format")
    public format: string;

    /** @description The voice the model uses to respond. Supported voices are alloy, ash, ballad, coral, echo, fable, nova, onyx, sage, and shimmer. */
        // @DataMember(Name="voice")
    public voice: string;

    public constructor(init?: Partial<AiChatAudio>) { (Object as any).assign(this, init); }
}

export enum ResponseFormat
{
    Text = 'text',
    JsonObject = 'json_object',
}

// @DataContract
export class AiResponseFormat
{
    /** @description An object specifying the format that the model must output. Compatible with GPT-4 Turbo and all GPT-3.5 Turbo models newer than gpt-3.5-turbo-1106. */
        // @DataMember(Name="response_format")
    public response_format: ResponseFormat;

    public constructor(init?: Partial<AiResponseFormat>) { (Object as any).assign(this, init); }
}

export enum ToolType
{
    Function = 'function',
}

// @DataContract
export class Tool
{
    /** @description The type of the tool. Currently, only function is supported. */
        // @DataMember(Name="type")
    public type: ToolType;

    public constructor(init?: Partial<Tool>) { (Object as any).assign(this, init); }
}

/** @description Annotations for the message, when applicable, as when using the web search tool. */
// @DataContract
export class UrlCitation
{
    /** @description The index of the last character of the URL citation in the message. */
        // @DataMember(Name="end_index")
    public end_index: number;

    /** @description The index of the first character of the URL citation in the message. */
        // @DataMember(Name="start_index")
    public start_index: number;

    /** @description The title of the web resource. */
        // @DataMember(Name="title")
    public title: string;

    /** @description The URL of the web resource. */
        // @DataMember(Name="url")
    public url: string;

    public constructor(init?: Partial<UrlCitation>) { (Object as any).assign(this, init); }
}

/** @description Annotations for the message, when applicable, as when using the web search tool. */
// @DataContract
export class ChoiceAnnotation
{
    /** @description The type of the URL citation. Always url_citation. */
        // @DataMember(Name="type")
    public type: string;

    /** @description A URL citation when using web search. */
        // @DataMember(Name="url_citation")
    public url_citation: UrlCitation;

    public constructor(init?: Partial<ChoiceAnnotation>) { (Object as any).assign(this, init); }
}

/** @description If the audio output modality is requested, this object contains data about the audio response from the model. */
// @DataContract
export class ChoiceAudio
{
    /** @description Base64 encoded audio bytes generated by the model, in the format specified in the request. */
        // @DataMember(Name="data")
    public data: string;

    /** @description The Unix timestamp (in seconds) for when this audio response will no longer be accessible on the server for use in multi-turn conversations. */
        // @DataMember(Name="expires_at")
    public expires_at: number;

    /** @description Unique identifier for this audio response. */
        // @DataMember(Name="id")
    public id: string;

    /** @description Transcript of the audio generated by the model. */
        // @DataMember(Name="transcript")
    public transcript: string;

    public constructor(init?: Partial<ChoiceAudio>) { (Object as any).assign(this, init); }
}

// @DataContract
export class ChoiceMessage
{
    /** @description The contents of the message. */
        // @DataMember(Name="content")
    public content: string;

    /** @description The refusal message generated by the model. */
        // @DataMember(Name="refusal")
    public refusal?: string;

    /** @description The reasoning process used by the model. */
        // @DataMember(Name="reasoning")
    public reasoning?: string;

    /** @description The role of the author of this message. */
        // @DataMember(Name="role")
    public role: string;

    /** @description Annotations for the message, when applicable, as when using the web search tool. */
        // @DataMember(Name="annotations")
    public annotations?: ChoiceAnnotation[];

    /** @description If the audio output modality is requested, this object contains data about the audio response from the model. */
        // @DataMember(Name="audio")
    public audio?: ChoiceAudio;

    /** @description The tool calls generated by the model, such as function calls. */
        // @DataMember(Name="tool_calls")
    public tool_calls?: ToolCall[];

    public constructor(init?: Partial<ChoiceMessage>) { (Object as any).assign(this, init); }
}

// @DataContract
export class Choice
{
    /** @description The reason the model stopped generating tokens. This will be stop if the model hit a natural stop point or a provided stop sequence, length if the maximum number of tokens specified in the request was reached, content_filter if content was omitted due to a flag from our content filters, tool_calls if the model called a tool */
        // @DataMember(Name="finish_reason")
    public finish_reason: string;

    /** @description The index of the choice in the list of choices. */
        // @DataMember(Name="index")
    public index: number;

    /** @description A chat completion message generated by the model. */
        // @DataMember(Name="message")
    public message: ChoiceMessage;

    public constructor(init?: Partial<Choice>) { (Object as any).assign(this, init); }
}

/** @description Usage statistics for the completion request. */
// @DataContract
export class AiCompletionUsage
{
    /** @description When using Predicted Outputs, the number of tokens in the prediction that appeared in the completion. */
        // @DataMember(Name="accepted_prediction_tokens")
    public accepted_prediction_tokens: number;

    /** @description Audio input tokens generated by the model. */
        // @DataMember(Name="audio_tokens")
    public audio_tokens: number;

    /** @description Tokens generated by the model for reasoning. */
        // @DataMember(Name="reasoning_tokens")
    public reasoning_tokens: number;

    /** @description When using Predicted Outputs, the number of tokens in the prediction that did not appear in the completion. */
        // @DataMember(Name="rejected_prediction_tokens")
    public rejected_prediction_tokens: number;

    public constructor(init?: Partial<AiCompletionUsage>) { (Object as any).assign(this, init); }
}

/** @description Breakdown of tokens used in the prompt. */
// @DataContract
export class AiPromptUsage
{
    /** @description When using Predicted Outputs, the number of tokens in the prediction that appeared in the completion. */
        // @DataMember(Name="accepted_prediction_tokens")
    public accepted_prediction_tokens: number;

    /** @description Audio input tokens present in the prompt. */
        // @DataMember(Name="audio_tokens")
    public audio_tokens: number;

    /** @description Cached tokens present in the prompt. */
        // @DataMember(Name="cached_tokens")
    public cached_tokens: number;

    public constructor(init?: Partial<AiPromptUsage>) { (Object as any).assign(this, init); }
}

/** @description Usage statistics for the completion request. */
// @DataContract
export class AiUsage
{
    /** @description Number of tokens in the generated completion. */
        // @DataMember(Name="completion_tokens")
    public completion_tokens: number;

    /** @description Number of tokens in the prompt. */
        // @DataMember(Name="prompt_tokens")
    public prompt_tokens: number;

    /** @description Total number of tokens used in the request (prompt + completion). */
        // @DataMember(Name="total_tokens")
    public total_tokens: number;

    /** @description Breakdown of tokens used in a completion. */
        // @DataMember(Name="completion_tokens_details")
    public completion_tokens_details?: AiCompletionUsage;

    /** @description Breakdown of tokens used in the prompt. */
        // @DataMember(Name="prompt_tokens_details")
    public prompt_tokens_details?: AiPromptUsage;

    public constructor(init?: Partial<AiUsage>) { (Object as any).assign(this, init); }
}

// @DataContract
export class ResponseError
{
    // @DataMember(Order=1)
    public errorCode: string;

    // @DataMember(Order=2)
    public fieldName: string;

    // @DataMember(Order=3)
    public message: string;

    // @DataMember(Order=4)
    public meta?: { [index:string]: string; };

    public constructor(init?: Partial<ResponseError>) { (Object as any).assign(this, init); }
}

// @DataContract
export class ResponseStatus
{
    // @DataMember(Order=1)
    public errorCode: string;

    // @DataMember(Order=2)
    public message?: string;

    // @DataMember(Order=3)
    public stackTrace?: string;

    // @DataMember(Order=4)
    public errors?: ResponseError[];

    // @DataMember(Order=5)
    public meta?: { [index:string]: string; };

    public constructor(init?: Partial<ResponseStatus>) { (Object as any).assign(this, init); }
}

/** @description Text content part */
// @DataContract
export class AiTextContent extends AiContent
{
    /** @description The text content. */
        // @DataMember(Name="text")
    public text: string;

    public constructor(init?: Partial<AiTextContent>) { super(init); (Object as any).assign(this, init); }
}

// @DataContract
export class AiImageUrl
{
    /** @description Either a URL of the image or the base64 encoded image data. */
        // @DataMember(Name="url")
    public url: string;

    public constructor(init?: Partial<AiImageUrl>) { (Object as any).assign(this, init); }
}

/** @description Image content part */
// @DataContract
export class AiImageContent extends AiContent
{
    /** @description The image for this content. */
        // @DataMember(Name="image_url")
    public image_url: AiImageUrl;

    public constructor(init?: Partial<AiImageContent>) { super(init); (Object as any).assign(this, init); }
}

/** @description Audio content part */
// @DataContract
export class AiInputAudio
{
    /** @description URL or Base64 encoded audio data. */
        // @DataMember(Name="data")
    public data: string;

    /** @description The format of the encoded audio data. Currently supports 'wav' and 'mp3'. */
        // @DataMember(Name="format")
    public format: string;

    public constructor(init?: Partial<AiInputAudio>) { (Object as any).assign(this, init); }
}

/** @description Audio content part */
// @DataContract
export class AiAudioContent extends AiContent
{
    /** @description The audio input for this content. */
        // @DataMember(Name="input_audio")
    public input_audio: AiInputAudio;

    public constructor(init?: Partial<AiAudioContent>) { super(init); (Object as any).assign(this, init); }
}

/** @description File content part */
// @DataContract
export class AiFile
{
    /** @description The URL or base64 encoded file data, used when passing the file to the model as a string. */
        // @DataMember(Name="file_data")
    public file_data: string;

    /** @description The name of the file, used when passing the file to the model as a string. */
        // @DataMember(Name="filename")
    public filename: string;

    /** @description The ID of an uploaded file to use as input. */
        // @DataMember(Name="file_id")
    public file_id?: string;

    public constructor(init?: Partial<AiFile>) { (Object as any).assign(this, init); }
}

/** @description File content part */
// @DataContract
export class AiFileContent extends AiContent
{
    /** @description The file input for this content. */
        // @DataMember(Name="file")
    public file: AiFile;

    public constructor(init?: Partial<AiFileContent>) { super(init); (Object as any).assign(this, init); }
}

// @DataContract
export class ChatResponse
{
    /** @description A unique identifier for the chat completion. */
        // @DataMember(Name="id")
    public id: string;

    /** @description A list of chat completion choices. Can be more than one if n is greater than 1. */
        // @DataMember(Name="choices")
    public choices: Choice[] = [];

    /** @description The Unix timestamp (in seconds) of when the chat completion was created. */
        // @DataMember(Name="created")
    public created: number;

    /** @description The model used for the chat completion. */
        // @DataMember(Name="model")
    public model: string;

    /** @description This fingerprint represents the backend configuration that the model runs with. */
        // @DataMember(Name="system_fingerprint")
    public system_fingerprint?: string;

    /** @description The object type, which is always chat.completion. */
        // @DataMember(Name="object")
    public object: string;

    /** @description Specifies the processing type used for serving the request. */
        // @DataMember(Name="service_tier")
    public service_tier?: string;

    /** @description Usage statistics for the completion request. */
        // @DataMember(Name="usage")
    public usage: AiUsage;

    /** @description Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. */
        // @DataMember(Name="metadata")
    public metadata?: { [index:string]: string; };

    // @DataMember(Name="responseStatus")
    public responseStatus?: ResponseStatus;

    public constructor(init?: Partial<ChatResponse>) { (Object as any).assign(this, init); }
}

/** @description Chat Completions API (OpenAI-Compatible) */
// @Route("/v1/chat/completions", "POST")
// @DataContract
export class ChatCompletion implements IReturn<ChatResponse>, IPost
{
    /** @description The messages to generate chat completions for. */
        // @DataMember(Name="messages")
    public messages: AiMessage[] = [];

    /** @description ID of the model to use. See the model endpoint compatibility table for details on which models work with the Chat API */
        // @DataMember(Name="model")
    public model: string;

    /** @description Parameters for audio output. Required when audio output is requested with modalities: [audio] */
        // @DataMember(Name="audio")
    public audio?: AiChatAudio;

    /** @description Modify the likelihood of specified tokens appearing in the completion. */
        // @DataMember(Name="logit_bias")
    public logit_bias?: { [index:number]: number; };

    /** @description Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. */
        // @DataMember(Name="metadata")
    public metadata?: { [index:string]: string; };

    /** @description Constrains effort on reasoning for reasoning models. Currently supported values are minimal, low, medium, and high (none, default). Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response. */
        // @DataMember(Name="reasoning_effort")
    public reasoning_effort?: string;

    /** @description An object specifying the format that the model must output. Compatible with GPT-4 Turbo and all GPT-3.5 Turbo models newer than `gpt-3.5-turbo-1106`. Setting Type to ResponseFormat.JsonObject enables JSON mode, which guarantees the message the model generates is valid JSON. */
        // @DataMember(Name="response_format")
    public response_format?: AiResponseFormat;

    /** @description Specifies the processing type used for serving the request. */
        // @DataMember(Name="service_tier")
    public service_tier?: string;

    /** @description A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies. The IDs should be a string that uniquely identifies each user. */
        // @DataMember(Name="safety_identifier")
    public safety_identifier?: string;

    /** @description Up to 4 sequences where the API will stop generating further tokens. */
        // @DataMember(Name="stop")
    public stop?: string[];

    /** @description Output types that you would like the model to generate. Most models are capable of generating text, which is the default: */
        // @DataMember(Name="modalities")
    public modalities?: string[];

    /** @description Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. */
        // @DataMember(Name="prompt_cache_key")
    public prompt_cache_key?: string;

    /** @description A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported. */
        // @DataMember(Name="tools")
    public tools?: Tool[];

    /** @description Constrains the verbosity of the model's response. Lower values will result in more concise responses, while higher values will result in more verbose responses. Currently supported values are low, medium, and high. */
        // @DataMember(Name="verbosity")
    public verbosity?: string;

    /** @description What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. */
        // @DataMember(Name="temperature")
    public temperature?: number;

    /** @description An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and reasoning tokens. */
        // @DataMember(Name="max_completion_tokens")
    public max_completion_tokens?: number;

    /** @description An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability. logprobs must be set to true if this parameter is used. */
        // @DataMember(Name="top_logprobs")
    public top_logprobs?: number;

    /** @description An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. */
        // @DataMember(Name="top_p")
    public top_p?: number;

    /** @description Number between `-2.0` and `2.0`. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim. */
        // @DataMember(Name="frequency_penalty")
    public frequency_penalty?: number;

    /** @description Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics. */
        // @DataMember(Name="presence_penalty")
    public presence_penalty?: number;

    /** @description This feature is in Beta. If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed, and you should refer to the system_fingerprint response parameter to monitor changes in the backend. */
        // @DataMember(Name="seed")
    public seed?: number;

    /** @description How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep `n` as `1` to minimize costs. */
        // @DataMember(Name="n")
    public n?: number;

    /** @description Whether or not to store the output of this chat completion request for use in our model distillation or evals products. */
        // @DataMember(Name="store")
    public store?: boolean;

    /** @description Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the content of message. */
        // @DataMember(Name="logprobs")
    public logprobs?: boolean;

    /** @description Whether to enable parallel function calling during tool use. */
        // @DataMember(Name="parallel_tool_calls")
    public parallel_tool_calls?: boolean;

    /** @description Whether to enable thinking mode for some Qwen models and providers. */
        // @DataMember(Name="enable_thinking")
    public enable_thinking?: boolean;

    /** @description If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a `data: [DONE]` message. */
        // @DataMember(Name="stream")
    public stream?: boolean;

    public constructor(init?: Partial<ChatCompletion>) { (Object as any).assign(this, init); }
    public getTypeName() { return 'ChatCompletion'; }
    public getMethod() { return 'POST'; }
    public createResponse() { return new ChatResponse(); }
}

